﻿using System.Web.Mvc;
using Orchard;

namespace Szmyd.Orchard.Modules.Jumpstart.Controllers
{
    /// <summary>
    /// An ordinary ASP.NET MVC controller.
    /// You can create controllers and actions as in ordinary MVC applications.
    /// </summary>
    public class HomeController : Controller
    {
        private readonly IOrchardServices _services;

        /// <summary>
        /// You can specify parameters in controller's ctor.
        /// Parameters will be injected by IoC controller with an appropriate object.
        /// IOrchardServices is the most commonly used object 
        /// - it is used to interact (get/save data from db, get request data and so on) with Orchard.
        /// </summary>
        /// <param name="services"></param>
        public HomeController(IOrchardServices services) {
            _services = services;
        }

        /// <summary>
        /// An ordinary ASP.NET MVC controller action
        /// </summary>
        /// <returns>Result</returns>
        public ActionResult Index() {

            // We display your site's name here
            return Content(_services.WorkContext.CurrentSite.SiteName);
        }
    }
}